Repository navigation
fix(grid): read scroll and filter input from their elements - 21.2.x - #18099
Open
rkaraivanov wants to merge 1 commit into
Open
rkaraivanov wants to merge 1 commit into
rkaraivanov wants to merge 1 commit into
Conversation
The vertical scroll handler runs after a throttle and the filter row input handler after a debounce. In a shadow root the browser clears the event target when the dispatch ends, so reading event.target threw and the rows did not follow the scrollbar or the filter was not applied. The for-of directives read the scroll element and the filter row reads its input element instead. Port of the #17860 fix to 21.2.x. Part of #18088 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A pending debounced input event can throw after switching to a Date or Time column because the filtering input no longer exists.
1 open issue
What changed in this PR
Ports the shadow-root scrolling and filter-row fixes from #17860 to 21.2.x, addressing part of #18088.
Changes:
- Read scroll positions and filter values directly from their elements.
- Add shadow-root regression tests and update scroll-throttle tests.
- Document the fixes under
21.2.28.
| File | Description |
|---|---|
projects/igniteui-angular/test-utils/grid-samples.spec.ts |
Adds a shared shadow-root grid fixture. |
projects/igniteui-angular/grids/grid/src/grid.component.spec.ts |
Tests shadow-root scrolling and updates throttle simulations. |
projects/igniteui-angular/grids/grid/src/grid-filtering-ui.spec.ts |
Tests debounced filtering inside a shadow root. |
projects/igniteui-angular/grids/core/src/filtering/base/grid-filtering-row.component.ts |
Reads filter values from the input element. |
projects/igniteui-angular/directives/src/directives/for-of/for_of.directive.ts |
Reads scroll positions from scroll elements. |
CHANGELOG.md |
Documents the shadow-root fixes. |
Review effort: Balanced
| // when you have a japanese character as a placeholder, on init the value here is empty string . | ||
| // Read the input, not the event target: the debounced call runs after the dispatch, when the browser | ||
| // has cleared the target of an event in a shadow tree. | ||
| const target = this.input.nativeElement; |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Refs #17860
Description
IgxForOfDirective.onScroll/onHScrollandIgxGridForOfDirective.onScrollread the scroll position from their scroll element instead ofevent.target.IgxGridFilteringRowComponentreads its input element instead ofevent.targetwhen the debounced input is handled. The check for date-time columns, which use the emittedDate, now runs before the input is read.Motivation / Context
This is the port of the #17860 part of # to
21.2.x. Part of #18088.The vertical scroll handler runs after a throttle and the filter row handler after a debounce. By then the browser has set
event.targettonullfor an event in a shadow tree, so in a grid that renders more than 100 cells each scroll threwCannot read properties of null (reading 'scrollTop'), and the filter row did not filter.#17859 does not apply to this branch: it has no
IgxStylesRegistrar, and its theme still carries the structural styles of the grid. The changelog entry is under21.2.28.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Grid, Tree Grid, Hierarchical Grid, Pivot Grid,
igxForHow Has This Been Tested?
Karma, with
grid.component.spec.ts,grid-filtering-ui.spec.ts, theigxForspecs and the pivot grid specs:scrollTopon the scroll element)The new specs use an
IgxGridInShadowRootComponentingrid-samples.spec.ts. It renders the grid inside@ifin aShadowDomcomponent and copies the stylesheets of the page into its shadow root.The run has 15 other failures, mostly row counts in the pivot grid specs. The same 15 fail on
21.2.xwithout this change in the same environment, where Karma used the system Chrome (PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome) instead of the pinned Puppeteer Chrome.Lint of the changed files: 0 errors.
Test Configuration:
Checklist:
CHANGELOG.MDupdates for newly added functionality🤖 Generated with Claude Code